package com.digitalart.futbol.hibernate.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.digitalart.futbol.hibernate.dao.LocalDao;
import com.digitalart.futbol.hibernate.ejb.Local;
import com.digitalart.futbol.hibernate.service.LocalService;

@Service
public class LocalServiceImpl implements LocalService{

	@Autowired(required=true)
	private LocalDao localDao;
	
	
	@Transactional
	public Local createLocal(Local local){
		Local result = (Local)this.localDao.persistOnMerge(local);
		return result;
		
	}
	
	@Transactional
	public Local retriveLocal(int id){
		Local result = this.localDao.findById(id);
		return result;
	}

	@Transactional
	public List<Local> getAll() {
		List<Local> result = this.localDao.findAll();
		return result;
	}
	
}
